﻿using ApiDemo.Modals;
using Microsoft.AspNetCore.Mvc;
using QQZiCore.Mvc.Controllers;
using QQZiFramework;
using QQZiFramework.MQ;

namespace ApiDemo.Controllers
{
    public class RabbitMQController : BaseController
    {
        /// <summary>
        /// 发布消息队列
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public JsonApiData PublishToQueue(string queueName,string msg)
        {
            using(DBContext context =CreateDBContext()){               
                context.GetMQDriver().Publish(queueName,msg);                                
            }
            return new JsonApiData();
        }
    }
}
